home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 16713 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.5 KB  |  42 lines

  1. Path: isonews.bbn.hp.com!hpbblb!news
  2. From: Matthias Dittrich <matti>
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: what does this code do?
  5. Date: 11 Apr 1996 15:36:03 GMT
  6. Organization: Hewlett-Packard Co.
  7. Message-ID: <4kj8t3$5m0@hpbblb.bbn.hp.com>
  8. References: <4k6u2v$i2c@newsbf02.news.aol.com> <3167217D.AC7@lex.infi.net>
  9. NNTP-Posting-Host: trabant.bbn.hp.com
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 1.1N (X11; I; HP-UX A.09.07 9000/712)
  14. X-URL: news:3167217D.AC7@lex.infi.net
  15.  
  16. Scott Hightower <hightowr@lex.infi.net> wrote:
  17. >Mrdavc wrote:
  18. >> 
  19. >> linePtrs[currentLine][lineLen[currentLine]] = (char) key;
  20. >> 
  21. >> What does this code do?  It looks like linePtrs is a multidimensional
  22. >> array but its not defined that way.  is both linePtrs[currentLine] and
  23. >> lineLen[currentLine] set to (char) key??
  24. >> 
  25. >> example from Teach yourself Turbo C++ 4.5 for Windows by Craig Arnush
  26. >> p,355
  27. >
  28. >Sorry, don't have the book avail to confirm this, but sounds like linePtrs
  29. >is an array of pointers to lines, which are themselves char[].  And
  30. >currentLine is an index into the array of pointers and another array of
  31. >lengths for each line.  So if currentLine=1423, and lineLen[1423]=64,
  32. >key is cast to char and placed at index 64 of the char array pointed to
  33. >by linePtrs[1423].  And then probably lineLen[1423] is incremented.
  34. >
  35. I can't see the increment operator (except in C++ :-).
  36. But linePtrs may be declared as
  37. char* linePtrs[MAX_INDEX];
  38.  
  39. Good luck,
  40. Matthias
  41.  
  42.